package log2story;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class Action {
	
	private static Action action = null;
	private static Properties properties;
	
	public static String FOLLOW = "seguir-a";
	public static String STOP_FOLLOW = "dejar-de-seguir";
	public static String DELETE_GROUP = "disolucion-grupo";
	
	private Action(){
		// Read properties file.
		properties = new Properties();
		try {
		    properties.load(new FileInputStream("conf/action.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static Action getInstance(){
		if (action==null){
			action = new Action();
		}
		return action;
	}
	
	public int getInterestForComplement(String action){
		return Integer.parseInt(properties.getProperty("complement."+action, "0"));
	}
	public int getInterestForSubject(String action){
		return Integer.parseInt(properties.getProperty("subject."+action, "0"));
	}
	
	public boolean hasAgentParameter(String action){
		return ((action=="seguir-a")||(action=="dejar-de-seguir")||(action=="obedecer")||(action=="ignorar"));
		
	}
//	/**
//	 * Andar hacia [lugar]
//Correr hacia
//Llegar a
//Salir de
//Entrar en [Lugar]
//Subir
//Bajar
//Ordenar
//Obedecer-a [Persona]
//Ignorar-a [Persona]
//Seguir-a [Persona]
//Dejar-de-seguir-a [Persona]
//Accidente [Muerte, Cada, Ataque Panico]
//Recoger [Objeto]
//Crear-grupo
//Deshacer-grupo
//	 */
//	
////
//	
//	public static int WALK_TO=0;
//	public static int RUN_TO=15;
//	public static int ARRIVE_TO=1;
//	public static int COLLISION=2;
//	public static int EXIT_FROM=3;
//	public static int ENTER_IN=4;
//	public static int GO_UP=6;//SUBIR
//	public static int GO_DOWN=7;
//	public static int ORDER=8;
//	public static int OBEY=9;
//	public static int IGNORE=10;
//	public static int FOLLOW =11;
//	public static int STOP_FOLLOW=12;
//	public static int ACCIDENT=13;
//	public static int DISOBEY_PICK_UP =14;//recoger
//	public static int CREATE_GROUP=16;
//	public static int DELETE_GROUP=17;
//	public static int DISOBEY_WALK_TO=18;
//	public static int DISOBEY_RUN_TO=19;
//	public static int DISOBEY_ARRIVE_TO=20;
//	public static int DISOBEY_EXIT_FROM=21;
//	public static int DISOBEY_ENTER_IN=22;
//	public static int DISOBEY_GO_UP=23;//SUBIR
//	public static int DISOBEY_GO_DOWN=24;
//	public static int BORN=25;
//	
//	public static int FIRE_ACCESS=0;//acceso
//	public static int FOCUS_STARTED=0;//inicio-foco
//	public static int SEARCH_FOR_DEPENDENTS=0;//buscar-dependientes
//	public static int BEGINING_IN=0;//empezar-en
//	public static int FIRE_WATCHED=0;//visto-fuego
//	public static int GOAL_ARCHIEVED=0;//llega-a-meta
//	public static int STAY_IN_SAFE_PLACE=0;//permanecer-lugar-seguro
//	
//
//	
//	public static int parseInt(String action){
//		int number = -1;
//		if (action.equalsIgnoreCase("Nacimiento"))
//			number=BORN;
//		else if (action.equalsIgnoreCase("Andar-hacia"))
//			number=WALK_TO;
//		else if (action.equalsIgnoreCase("Correr-hacia"))
//			number=RUN_TO;
//		else if (action.equalsIgnoreCase("Llegar-a"))
//			number=ARRIVE_TO;
//		else if (action.equalsIgnoreCase("Colision"))
//			number=COLLISION;
//		else if (action.equalsIgnoreCase("Salir-de"))
//			number=EXIT_FROM;
//		else if (action.equalsIgnoreCase("Entrar-en"))
//			number=ENTER_IN;
//		else if (action.equalsIgnoreCase("Seguir-a"))
//			number=FOLLOW;
//		else if (action.equalsIgnoreCase("Subir"))
//			number=GO_UP;
//		else if (action.equalsIgnoreCase("Bajar"))
//			number=GO_DOWN;
//		else if (action.equalsIgnoreCase("Ordenar"))
//			number=ORDER;
//		else if (action.equalsIgnoreCase("Obedecer"))
//			number=OBEY;
//		else if (action.equalsIgnoreCase("Ignorar"))
//			number=IGNORE;
//		else if (action.equalsIgnoreCase("Dejar-de-seguir-a"))
//			number=STOP_FOLLOW;
//		else if (action.equalsIgnoreCase("Accidente"))
//			number=ACCIDENT;
//		else if (action.equalsIgnoreCase("Recoger"))
//			number=DISOBEY_PICK_UP;
//		else if (action.equalsIgnoreCase("Creacion-grupo"))
//			number=CREATE_GROUP;
//		else if (action.equalsIgnoreCase("Deshacer-grupo"))
//			number=DELETE_GROUP;
//		else if (action.equalsIgnoreCase("Desobedecer-andar-hacia"))
//			number=DISOBEY_WALK_TO;
//		else if (action.equalsIgnoreCase("Desobedecer-correr-hacia"))
//			number=DISOBEY_RUN_TO;
//		else if (action.equalsIgnoreCase("Desobedecer-llegar-a"))
//			number=DISOBEY_ARRIVE_TO;
//		else if (action.equalsIgnoreCase("Desobedecer-salir-de"))
//			number=DISOBEY_EXIT_FROM;
//		else if (action.equalsIgnoreCase("Desobedecer-entrar-en"))
//			number=DISOBEY_ENTER_IN;
//		else if (action.equalsIgnoreCase("Desobedecer-subir"))
//			number=DISOBEY_GO_UP;
//		else if (action.equalsIgnoreCase("Desobedecer-bajar"))
//			number=DISOBEY_GO_DOWN;
//		/*
//	public static int FIRE_ACCESS=0;//acceso
//	public static int FOCUS_STARTED=0;//inicio-foco
//	public static int SEARCH_FOR_DEPENDENTS=0;//buscar-dependientes
//	public static int BEGINING_IN=0;//empezar-en
//	public static int FIRE_WATCHED=0;//visto-fuego
//	public static int GOAL_ARCHIEVED=0;//llega-a-meta
//	public static int STAY_IN_SAFE_PLACE=0;//permanecer-lugar-seguro
//		 */		
//		else if (action.equalsIgnoreCase("inicio-foco"))
//			number=FOCUS_STARTED;
//		else if (action.equalsIgnoreCase("acceso"))
//			number=FIRE_ACCESS;
//		else if (action.equalsIgnoreCase("buscar-dependientes"))
//			number=SEARCH_FOR_DEPENDENTS;
//		else if (action.equalsIgnoreCase("empezar-en"))
//			number=BEGINING_IN;
//		
//		else if (action.equalsIgnoreCase("visto-fuego"))
//			number=FIRE_WATCHED;
//		else if (action.equalsIgnoreCase("llega-a-meta"))
//			number=GOAL_ARCHIEVED;
//		else if (action.equalsIgnoreCase("permanecer-lugar-seguro"))
//			number=STAY_IN_SAFE_PLACE;
//		return number;
//	}
//	
//	public static String parseString(int action){
//		String st = "";
//		
//		if (action==BORN)
//			st="Nacimiento";
//		else if (action==WALK_TO)
//			st="Andar-hacia";
//		else if (action==RUN_TO)
//			st="Correr-hacia";
//		else if (action==ARRIVE_TO)
//			st="Llegar-a";
//		else if (action==FOLLOW)
//			st="Seguir-a";
//		else if (action==COLLISION)
//			st="Colision";
//		else if (action==EXIT_FROM)
//			st="Salir-de";
//		else if (action==ENTER_IN)
//			st="Entrar-en";
//		else if (action==GO_UP)
//			st="Subir";
//		else if (action==GO_DOWN)
//			st="Bajar";
//		else if (action==ORDER)
//			st="Ordenar";
//		else if (action==OBEY)
//			st="Obedecer";
//		else if (action==STOP_FOLLOW)
//			st="Dejar-de-seguir-a";
//		else if (action==ACCIDENT)
//			st="Accidente";
//		else if (action==DISOBEY_PICK_UP)
//			st="Recoger";
//		else if (action==CREATE_GROUP)
//			st="Creacion-grupo";
//		else if (action==DELETE_GROUP)
//			st="Deshacer-grupo";
//		else if (action==DISOBEY_ARRIVE_TO)
//			st="Desobedecer-llegar-a";
//		else if (action==DISOBEY_WALK_TO)
//			st="Desobedecer-andar-hacia";
//		else if (action==DISOBEY_RUN_TO)
//			st="Desobedecer-correr-hacia";
//		else if (action==DISOBEY_EXIT_FROM)
//			st="Desobedecer-salir-de";
//		else if (action==DISOBEY_ENTER_IN)
//			st="Desobedecer-entrar-en";
//		else if (action==DISOBEY_GO_UP)
//			st="Desobedecer-subir";
//		else if (action==DISOBEY_GO_DOWN)
//			st="Desobedecer-bajar";
//		return st;
//	}
//	
//	public static int getInterestForSubject(int action){
//		int st = 0;
//		
//		if (action==BORN)
//			st=1;
//		else if (action==WALK_TO)
//			st=1;
//		else if (action==RUN_TO)
//			st=1;
//		else if (action==ARRIVE_TO)
//			st=1;
//		else if (action==COLLISION)
//			st=1;
//		else if (action==EXIT_FROM)
//			st=1;
//		else if (action==ENTER_IN)
//			st=1;
//		else if (action==FOLLOW)
//			st=1;
//		else if (action==GO_UP)
//			st=1;
//		else if (action==GO_DOWN)
//			st=1;
//		else if (action==ORDER)
//			st=1;
//		else if (action==OBEY)
//			st=1;
//		else if (action==IGNORE)
//			st=1;
//		else if (action==STOP_FOLLOW)
//			st=1;
//		else if (action==ACCIDENT)
//			st=100;
//		else if (action==DISOBEY_PICK_UP)
//			st=1;
//		else if (action==CREATE_GROUP)
//			st=1;
//		else if (action==DELETE_GROUP)
//			st=1;
//		else if (action==DISOBEY_ARRIVE_TO)
//			st=1;
//		else if (action==DISOBEY_WALK_TO)
//			st=1;
//		else if (action==DISOBEY_RUN_TO)
//			st=1;
//		else if (action==DISOBEY_EXIT_FROM)
//			st=1;
//		else if (action==DISOBEY_ENTER_IN)
//			st=1;
//		else if (action==DISOBEY_GO_UP)
//			st=1;
//		else if (action==DISOBEY_GO_DOWN)
//			st=1;
//		return st;
//	}
//	
//	public static int getInterestForComplement(int action){
//		int st = 0;
//		
//		if (action==BORN)
//			st=1;
//		else if (action==WALK_TO)
//			st=1;
//		else if (action==RUN_TO)
//			st=1;
//		else if (action==ARRIVE_TO)
//			st=1;
//		else if (action==COLLISION)
//			st=1;
//		else if (action==EXIT_FROM)
//			st=1;
//		else if (action==OBEY)
//			st=1;
//		else if (action==FOLLOW)
//			st=1;
//		else if (action==IGNORE)
//			st=1;
//		else if (action==STOP_FOLLOW)
//			st=1;
//		else if (action==ACCIDENT)
//			st=1;
//		else if (action==DISOBEY_PICK_UP)
//			st=1;
//		else if (action==CREATE_GROUP)
//			st=1;
//		else if (action==DELETE_GROUP)
//			st=1;
//		else if (action==DISOBEY_ARRIVE_TO)
//			st=1;
//		else if (action==DISOBEY_WALK_TO)
//			st=1;
//		else if (action==DISOBEY_RUN_TO)
//			st=1;
//		else if (action==DISOBEY_EXIT_FROM)
//			st=1;
//		else if (action==DISOBEY_ENTER_IN)
//			st=1;
//		else if (action==DISOBEY_GO_UP)
//			st=1;
//		else if (action==DISOBEY_GO_DOWN)
//			st=1;
//		return st;
//	}
//	
//	public static boolean hasAgentParameter(int action){
//		return ((action==FOLLOW)||(action==STOP_FOLLOW)||(action==OBEY)||(action==IGNORE));
//			
//	}

}
